import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2025-02-24
 * Time: 18:59
 */


public class Test1 {
    public static int[] insertionSort(int[] array){
        for(int i = 1 ; i < array.length ; i++){
            int tmp = array[i];
            int j = i-1;
            for(; j >= 0 ; j--){
                if(tmp < array[j]){
                    array[j+1] = array[j];
                }else{
                    break;
                }
            }
            array[j+1] = tmp;
        }
        return array;
    }
    public static void main(String[] args) {
        int[] array = {23,45,56,68,8,9};
        insertionSort(array);
        System.out.println(Arrays.toString(array));
    }

}
